$def with()
<html>
<head>
	<link href="$:config.static/style.css" rel="stylesheet" type="text/css" />
	<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
	<title>Chat Room</title>
</head>
<body bgcolor="#0123">
<script type="text/javascript">
function check()
 {
 var xmlHttp;
 try
    {
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("No support AJAX");
         return false;
         }
      }
    }
    
    xmlHttp.open("GET","/checkusr",true);
    xmlHttp.send(null);
    xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4 && xmlHttp.status == 200)
    	{
    		var obj = eval(xmlHttp.responseText);
    		var len = obj.length;
    		//var onlinename = new Array();
    		var flag = false;
    		var myname = document.myform.usr.value;
    		
    		for(var i=0;i<len;++i)
    		{
    			if(myname == obj[i].name)
    			{
    				flag = true;
    			}
    		}
    		
    		if(flag == true)
    		{
    			alert("Usr already exsists!");
    			document.myform.usr.value = '';
    		}
    		login(myname);
    	}
    }
	
 }
 
function login(myname)
 {
 var xmlHttp;
 try
    {
    xmlHttp=new XMLHttpRequest();
    }
 catch (e)
    {

   try
      {
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
      }
   catch (e)
      {

      try
         {
         xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
         }
      catch (e)
         {
         alert("No support AJAX");
         return false;
         }
      }
    }

    xmlHttp.open("POST","/",true);
    xmlHttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded"); 
    xmlHttp.send(myname);
    xmlHttp.onreadystatechange=function()
    {
    	if(xmlHttp.readyState==4 && xmlHttp.status == 200)
    	{
    		//document.bodyleft.innerHTML = xmlHttp.responseText;
    		//window.open("/chat");
    		//window.close();
    		window.location.href = "/chat/123";
    	}
    }
	
 };
 </script>
 		<div class="test"></div>
		<div align="center" style="padding-top:20%">
			<form name="myform" method="post" >
				<label>User:</lable>
				<input align="left" type="text" name="usr" onkeydown="if(event.keyCode==13)check();"><br><br>
				<input type="button" value="Confirm" size="1000" onclick="check()">
				<input type="text" size="0" style="visibility:hidden;">
			</form>
		</div>
	</body>
</html>
